package org.xtremeobjects.domain.model.java5;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.xtremeobjects.domain.model.Operation;

public class OperationJava5 implements Operation {

	private ClazzJava5 clazz;
	private Method method;
	
	public OperationJava5(ClazzJava5 clazz, Method method) {
		this.clazz = clazz;
		this.method = method;
	}
	
	public String getLabel() {
		return method.getName();
	}

	public String getName() {
		return method.getName();
	}

	public Object invoke(Object obj, Object []args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
		return method.invoke(obj,args);
	}

	public boolean hasParameters() {
		return method.getGenericParameterTypes().length>0;
	}

}
